Letters, Mousehole
Volume Number: 1
Issue Number: 3
Column Tag: LETTERS, MOUSEHOLE
Letters, Mousehole
NO VAPOROUS FLUFF
Enclosed is my subscription to MacTech. I really appreciate the quality of the
articles and the technical detail they contain. MacTech is a refreshing change from the
vaporous mass market Macintosh magazines. I would like to see in a future issue, an
article or series of articles describing how to interface with the packages, in
particular the disk package.
Robert Leyland
Novato, CA.
A C BENCHMARK PROGRAM
While I do have your attention, I would like to pose the following test for the Mac
C compiler from Consulair Corporation:
main()
{
union u_storage{
long a_long;
struct T_0000{
short a_short;
short B_short;
}S_0000;
)storage;
storage.a_long = 6;
printf(“/na_short = %d”, storage.S_0000.a_short);
printf(“/nb_short = %d”, storage.S_0000.b_short);
printf(“/n”);
}
Three implementations I worked with generated these results:
COMPILER X:
a_short = 60
b_short = 0
COMPILER Y:
a_short = 0
b_short = 60
COMPILER Z:
a_short = 0
b_short = 6
If Consulair’s C generates code similar to Compiler Z, I am definitely interested
in it!
Robert Heinich
Boca Raton, Fl.
There wasn’t time to report the results this month, but watch for it next month
in Bob’s C column. D.S.
A CONTROL DEFINITION FUNCTION
Thought I’d share with your readers part of a program I’m working on. I need to
have a control similar to the small double-pointed arrow used to set the time in the
alarm clock, except acting more like the arrows in scroll bars, which activate only
when you release the mouse button. According to the Control Manager section of Inside
Macintosh, this requires writing a control definition function. The problem is, the
other Toolbox routines treat this routine as if it were written in Pascal, and I want to
use Aztec C. (Note: there is no problem calling a Pascal format toolbox routine from
C). This required writing an assembly-language interface. [Manx informs me that they
will soon be upgrading their C to allow imitatiing Pascal; this may still be useful for
users of other C compilers]
My routine is called arrow_ctrl; this is actually the name of the assembly lang-
uage interface which Toolbox routines like FindControl() call. It saves the caller’s
address, then calls the high-level language routine a_ctrl. Since Pascal pushes
arguements on the stack in the reverse order from C, I could have switched them in
arrow_ctrl. Instead, I decided it was more efficient merely to reverse the order in
a_ctrl (thus it varies from the archetypical MyControl() in IM). Aztec C returns the
function value in register D0; Pascal expects it to be on the top of the stack. This is
because Pascal functions pop their arguments off the stack; C requires the calling
function to do this (thus allowing for variable numbers of arguments). [See figure 1
for an illustration of the stack used by C and Pascal; note distinction between words and
longwords.]
What took me a bit longer to figure out was that C is using some registers that
Pascal considers sacred. According to Manx, these were registers A2 and D3. An earlier
version of my interface saved all registers except D0 and SP; you might want to do this
for safety if you’re using a different compiler.
C PROGRAM SHELL
/* args are reversed because of Pascal
call */
long a_ctrl(param,message,ctrl,
variation)
int variation,message;
ControlHandle ctrl;
long param;
{
Rect *r;

r = &((**ctrl).contrlRect); /*pointer
to control’s rectangle */
switch (message) {
case initCntl:
.
. etc.
.
}
return(OL);
}
ASSEMBLY PROGRAM
long save_r, save_a2, save_d3; /* Used
in ASM interface */
#asm
public arrow_ct_ ;note truncation
arrow_ct_:
move.l (SP)+, save_r_ ;pop return addr.
move.l A2, save_a2_ ;save registers that C
doesn’t, but Pascal does
move.l D3, save_d3_
jsr a_ctrl_ ;call C routine
add.w #12,SP ;wipe out params
move.l D0,(SP) ;put return value in Pascal position
move.l save_a2_,A2 ;restore register
move.l save_d3_,D3 ;restore register
move.l save_r_, -(SP) ;push return addr
rts ;return to caller
#endasm
David Dunham
Goleta, CA.
MacPascal Looks Great!
The idea of a magzine devoted to programming and programmers is great. I am
really looking forward to getting the first issue. I hope you have some good articles on
MacPascal. I got mine the other day and it really looks nice. I just wish Apple would
have put in a tutorial since I don’t know Pascal that well (yet). Oh well, learning the
hard way is part of the fun. The store where I work is starting a Macintosh Users
Group. We plan a newsletter and hopefully a BBS. When we get the newsletter printed
up, I’ll send you a copy of it.
Jeff Goza
Abilene, TX.
Inside Mac Trouble
I am writingin regards to your ad in the new MacWorld. Journal looks really
fantastic for me. I have trouble with Inside Mac, but seem to have more assembly
/Pascal experience than most. However, I am a student, and [it follows...] poor. So, if
you would, please send me a sample issue of MacTech at your convenience to try it out.
(Enclosed is $2 for said issue).
Barry Polley
Ithaca, NY
Sample issue from last month is on the way. D.S.
C Questions...
I recieved my first issue of MacTech. Terrific! If the content continues to
improve from this level of good programming aids for the Mac, it will be a superior
Tech Journal. A few quick questions: Several references are made to Consulair C; I
would appreciate more info on availability and cost. How does the Aztec C for the Mac
stack up against the Consulair C or the Hippo C or others? This might make a good
short article for MacTech. I use the Aztec C for the Apple II but it came bare-bones
with no support library for Apple Graphics, sound or anything. Is the Aztec Mac C any
beter?
David B. William
Professor of Music
Illinois State U.
We currently are avoiding the software review tar pits. But Bob may wish to
respond in the next issue.
Doctor’s Orders
I recently noticed your ad in the MacWorld (Jan. 85) issue. It looks as though
this may be what the doctor (Ph.D.) ordered! And would you please be sure to include
the Nov. 84 [Dec] issue.
Dr. Bill Roberts
Golden, CO.
The Dec. issue is only available for $3, as there are just a few left. D.S.
MOUSEHOLE REPORT
RUSTY HODGE
SYS OP
A MAC BBS
Benchmarks
Here are some “Sieve” benchmark measurements in case no one else has
provided them:
MacPascal ..... 1,270 seconds
Basic 2.0 ...... 1,156 seconds
Basic 2.0 (compressed).... 1,040 seconds
I tried programming MacBasic V.82 but had series problems with system errors.
(It’s not ready for anything serious yet). Interesting part was that it said “DIM
Flags(8190) exceeded dimension limits”. Congrats on issue two, it’s stuffed with lots
of goodies and will take a month to explore each of the different articles. I’m kinda
disappointed that MacPascal was slower than basic. The “compressor” aspect of Basic
2.0 looks like a good efficiency improver with 15-20 percent for this small program.
JCOM
MacTech
Just got my first MacTech and it looks great!!! Finally something to explain that
#$@*@ IM manual! If you are considering sending in your $$ to get MacTech, do it
now. Don’t wait, you won’t be sorry. What do I need to do to get Vol. 1, No. 1? I’ll send
my right arm to get that assembly shell. Sounds great.
THE ATOM
MS WORD
I just got the Dec. 15 version of MS Word and I must say that it is just what I
need in the way of a real word processor. You can have four documents open at once and
you can divide them into two sections just like Multiplan. I had heard that the older
versions of Word worked really slow, but this seems to work fine and has drivers for
lots of letter quality printers. It is not all that easy to change fonts and stuff, but how
many times do you really use more than 2 or 3 fonts in a file? Also you have a
horizontal scroll bar taht goes out to somewhere around 18" so that problem is
history. Also support of footnotes and other goodies make this the real Word processor
that anyone who needs series word processing needs. This version still doesn’t have
multiple rulers, but I will call them up and see if they are going to implement them.
And as most MS products, Word has a nice help file and other goodies.
THE WATCHMAN
WAIT FOR CALL...FOREVER!
When using MacTerminal and Apple modems, do NOT select “Wait for Call”. Just
do nothing after starting and it WILL answer calls. With Hayes modems, DO select
“Wait for Call”. Apparently the Apple modem isn’t as Hayes compatable as we thought.
ROBERT WIGGINS
SOFTWARE SUPPLEMENT WORTH IT!
If anyone is considering buying INSIDE MACINTOSH from Apple, spend the extra
$100 and get the software supplement too. Not only are you the first on your block to
get the new Mac utilities (like resource editor), but you also get all the Lisa software.
Useless if you don’t have a lisa you ask? The software is no good to you, but I’ve
already gotten my money back by using those disks instead of buying another couple of
boxes of blank ones!
BURRILL SMITH